<template>
  <div class="view">
    <div>
      <h1>已支付 {{travelInfo.orderTotalAmount}}元</h1>
      <div class="flex1 gray-font">
        <text v-if="travelInfo.payMethod == 1">微信支付</text>
        <text v-if="travelInfo.payMethod == 2">支付宝支付</text>
        <text v-if="travelInfo.payMethod == 3">金币支付</text>
        <text v-if="travelInfo.payMethod == 4">红包车0元订单</text>
        <text v-if="travelInfo.payMethod == 5">企业支付</text>
      </div>
      <div class="flex1 gray-font" v-for="(item,index) in travelInfo.first" :key="index">
        <text :style="'color:'+item.color">{{item.left}}</text>
        <text :style="'color:'+item.color">{{item.right}}</text>
      </div>
      <div class="line" style="margin-top: 50rpx"></div>
      <div class="flex1 gray-font otherpay" v-for="(item,index) in travelInfo.second" :key="index">
        <text :style="'color:'+item.color">{{item.left}}</text>
        <text :style="'color:'+item.color">{{item.right}}</text>
      </div>
      <div class="line"></div>
      <div class="flex1 gray-font otherpay" v-for="(item,index) in travelInfo.third" :key="index">
        <text :style="'color:'+item.color">{{item.left}}</text>
        <text :style="'color:'+item.color">{{item.right}}</text>
      </div>
      <div class="line" v-if="travelInfo.third.length > 0"></div>
    </div>
    <div class="fix-btn">
      <button class="btn pass" @click="back" :disabled="disable">完成骑行</button>
    </div>

  </div>
</template>

<script>
  import Service from '@/utils/service'

  export default {
    data() {
      return {
        orderNo: '',
        travelInfo: {
          orderTotalAmount: '',
          first: [],
          second: [],
          third: [],
          disable:false
        }
      }
    },
    onUnload() {
      // setTimeout(() => {
      //   wx.reLaunch({
      //     url: '../index/main'
      //   })
      // }, 200)
    },
    onLoad(options) {
      this.orderNo = options.orderNo
      this.getCostDetail(this.orderNo)
    },
    methods: {
      back() {
        // setTimeout(() => {
          wx.reLaunch({
            url: '../index/main'
          })
        // }, 200)
      },
      getCostDetail(orderNo) {
        let data = {
          orderNo: orderNo
        }
        Service.getCostDetail(data).then((res) => {
          if (res.code == 200) {
            this.travelInfo = res.data
          }
        })
      },
    }
  }
</script>

<style scoped>
  .view {
    padding: 50px 50px 170px 50px;
    text-align: center;
  }

  .img3 {
    width: 176px;
    height: 152px;
    margin-top: 253px;
    margin-bottom: 36px;
  }

  h1 {
    line-height: 100px;
    font-size: 46px;
    margin-bottom: 0;
    text-align: left;
    margin-bottom: 60px;
  }

  .flex1 {
    justify-content: space-between;
    font-size: 30px;
    font-family: PingFangSC-Regular;
    color: rgba(102, 102, 102, 1);
    line-height: 42px;
  }

  .flex1 text {
    line-height: 55px;
  }

  .gray-font {
    color: #666;
  }

  .fix-btn {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px -2px 8px 0px rgba(0, 0, 0, 0.1);
  }

  .fix-btn .btn {
    margin-top: 35px;
    margin-bottom: 35px;
  }

  .green-font {
    color: #2C9D23;
  }

  .gray001-font {
    color: #ddd;
  }

  .red-font {
    color: #FF5E5E;
  }

  .otherpay text {
    line-height: 120px;
  }

  .payment {
    height: 120px;
    line-height: 120px;
    border-bottom: 2px solid #DDDDDD;
    font-size: 30px;
    color: #333333;
  }

  .payment-label, .but {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .gray {
    color: #999
  }

  .icon {
    width: 50px;
    height: 50px;
    margin-right: 20px;
  }

  .select {
    width: 48px;
    height: 48px;
  }

  .disabled {
    border-radius: 24px;
    background: #E7E7E7;
  }
</style>
